Skip to content

feat: Add Google Gemini CLI adapter with full export, run, and import support#41

Merged
shreyas-lyzr merged 7 commits intoopen-gitagent:mainfrom
AJAmit17:feat/gemini-cli
Mar 25, 2026
Merged

feat: Add Google Gemini CLI adapter with full export, run, and import support#41
shreyas-lyzr merged 7 commits intoopen-gitagent:mainfrom
AJAmit17:feat/gemini-cli

Conversation

@AJAmit17
Copy link
Copy Markdown
Contributor

What

Added Google Gemini CLI adapter for gitagent with full export, run, and import support.

Why

Enables gitagent users to work with Google's Gemini CLI format, allowing them to export agents to Gemini CLI, run agents using the gemini runtime, and import existing Gemini CLI projects.

Closes #33

How Tested

  • npm run build passes
  • gitagent validate passes on example agents
  • Manual testing:
    - gitagent export --format gemini -d examples/full generates valid files
    - gitagent run -d examples/full --adapter gemini -p "test" executes successfully
    - gitagent import --from gemini <path> creates valid agent.yaml
    - Hooks work on Windows (bash scripts execute via PowerShell)

Checklist

  • My code follows the existing style of this project
  • I have updated documentation (if applicable)
  • I have read the CONTRIBUTING.md

Add `gemini` format that generates GEMINI.md and .gemini/settings.json compatible with Google Gemini CLI.

The adapter maps gitagent's SOUL.md, RULES.md, skills, knowledge, and compliance constraints into Gemini's instruction format. Import reads GEMINI.md and settings.json to reconstruct agent.yaml with model preferences and approval mode mappings (plan→always, default→conditional, yolo→none, auto_edit→advisory).
Add `gemini` runner that creates temp workspace with GEMINI.md and .gemini/settings.json, then launches `gemini` CLI in interactive or single-shot mode (`-p` flag).

The runner copies hooks directory if present, maps approval modes to CLI flags (plan/default/yolo/auto_edit), and handles Windows shell quoting for args with spaces.

Also fixes buildHooksConfig to check hooks.yaml existence inside try block and use consistent null
… CLI

On Windows, Gemini CLI uses PowerShell which can't execute .sh files directly. Prepend 'bash' and include the hooks/ directory path when the script ends with .sh on win32 platform.
…pter

Previously only Windows .sh scripts got the hooks/ prefix. Now all hook scripts include the hooks/ directory path, with Windows .sh scripts additionally getting the 'bash' prefix.
@AJAmit17 AJAmit17 changed the title Feat/gemini cli feat: Add Google Gemini CLI adapter with full export, run, and import support Mar 23, 2026
@shreyas-lyzr shreyas-lyzr merged commit e2a9050 into open-gitagent:main Mar 25, 2026
@shreyas-lyzr
Copy link
Copy Markdown
Contributor

Reviewed and merged with one fix applied.

What looked good:

  • Follows existing adapter patterns exactly (OpenCode, Cursor)
  • GEMINI.md + .gemini/settings.json format is correct per Gemini CLI docs
  • Hook event mapping (SessionStart, BeforeTool, AfterTool, etc.) is accurate
  • Approval mode <> compliance.supervision.human_in_the_loop mapping is well thought out
  • Comprehensive docs at docs/adapters/gemini.md with limitations table
  • Uses shared buildComplianceSection (no duplication)
  • Copies hooks directory to temp workspace for runner (good catch)
  • 14/14 tests pass, build clean

Fix applied:

  • Import was reading settings.model as a string, but Gemini CLI stores it as { id: "...", provider: "..." }. Fixed to handle both formats for round-trip fidelity.

Nice work @AJAmit17 — closes #33!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Adapter] Google Gemini CLI

2 participants